﻿using System;
using System.Collections.Generic;

namespace Icms.Core.Model
{
    public class User : DelEntity
    {
        public string Login { get; set; }
        public string Password { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string Surname { get; set; }
        public virtual ICollection<Role> Roles { get; set; }
        public virtual Court Court { get; set; }
        public Guid? CourtId { get; set; }
    }

    public class Role : Entity
    {
        public string Title { get; set; }
        public string Name { get; set; }
        public virtual ICollection<User> Users { get; set; }
    }

    public enum CaseKind
    {
        civil = 1,
        penal,
        contraventional,
        economic
    }

    public enum InstanceKind
    {
        simple = 0,
        appeal,
        supreme
    }

    public class Classifier : DelEntity
    {
        public string Code { get; set; }
        public string Title { get; set; }
        public int? CaseKind { get; set; }
        public int? InstanceKind { get; set; }
        public virtual ICollection<Parameter> Parameters { get; set; }
    }

    public class Parameter : DelEntity, ITitle
    {
        public string Code { get; set; }
        public string Title { get; set; }
        public string Comments { get; set; }
        public int? Ord { get; set; }
        public virtual Classifier Classifier { get; set; }
        public Guid ClassifierId { get; set; }
        public Guid? ChildClassifierId { get; set; }
    }
   
    public class Category : Entity, ITitle
    {
        public string Title { get; set; }
        public virtual ICollection<CaseType> CaseTypes { get; set; }
    }

    public class CaseType : DelEntity
    {
        public string Title { get; set; }
        public string Code { get; set; }
        public int TimeResolved { get; set; }
        public virtual Category Category { get; set; }
        public Guid CategoryId { get; set; }

        public virtual ICollection<Case> Cases { get; set; }
        
    }

    public class CourtType : Entity
    {
        public int Code { get; set; }
        public string Title { get; set; }
    }

    public class Court : DelEntity
    {
        public virtual CourtType CourtType { get; set; }
        public Guid CourtTypeId { get; set; }
        public Guid? ParentId { get; set; }
        public virtual Court Parent { get; set; }
        public string Number { get; set; }
        public string Idno { get; set; }
        public string Title { get; set; }
        public Guid? RegionId { get; set; }
        public virtual Parameter Region { get; set; }
        public string Location { get; set; }
        public string Street { get; set; }
        public string Home { get; set; }
        public string Apartment { get; set; }
        public string Phone { get; set; }
        public string Fax { get; set; }
        public string Email { get; set; }
        public string Wsuri { get; set; }
        public bool IsAdministrative { get; set; }
    }

    public class Room : DelEntity
    {
        public string Title { get; set; }
        public string Position { get; set; }
        public virtual Court Court { get; set; }
        public Guid CourtId { get; set; }
    }

    public class Template : DelEntity
    {
        public string Title { get; set; }
        public string Content { get; set; }
        public Guid TypeId { get; set; }
        public virtual Parameter Type { get; set; }
    }

    public interface IHasCourt
    {
        Court Court { get; set; }
    }

    public class Team : DelEntity, IHasCourt
    {
        public string Title { get; set; }
        public virtual Court Court { get; set; }
        public Guid CourtId { get; set; }
        public Guid JudgeId { get; set; }
        public virtual User Judge { get; set; }
        public Guid SecretarialId { get; set; }
        public virtual User Secretarial { get; set; }
    }

    public class CourtCfg : Entity
    {
        public Guid CourtId { get; set; }
        public virtual Court Court { get; set; }
        public bool ManualAssignForAdministrativeCases { get; set; }
        public bool ManualAssignForCivilCases { get; set; }
        public bool ManualAssignForCriminalCases { get; set; }
        public bool ManualAssignForEconomicCases { get; set; }
        public DateTime OldCaseMaxDate { get; set; }
        public int RandomAssignmentDeputyPersent { get; set; }
        public int RandomAssignmentPresidentPersent { get; set; }
        public bool UseCollegesInRandomAssignment { get; set; }
    }
}